<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        ul {
            list-style: none;
        }

        li {
            float: left;
            width: 200px;
            text-align: center
        }
    </style>
    <script>
        function init() {
            let abuttons = document.querySelectorAll(".a_btn");
            let insertLocation = document.getElementById("insertLocation");
            [...abuttons].forEach((item)=>{
                item.addEventListener("click",(event)=>{
                    event.preventDefault();
                    let url = item.href.substring(item.href.lastIndexOf("/")+1);
                    //history.pushState({},"",url);
                    switch (url) {
                        case "emp":
                            insertLocation.innerHTML = "我是员工";
                            break;
                        case "manager":
                            insertLocation.innerHTML = "我是管理员";
                            break;
                        default: break;
                    }
                },false)
            })
        }
        window.addEventListener("load", init, false);
    </script>

</head>

<body>
    <ul>
        <li>
            <a class="a_btn" href="emp">员工</a>
        </li>
        <li>
            <a class="a_btn" href="manager">管理员</a>
        </li>
    </ul>
    <br>
    <hr>
    <section id="insertLocation">

    </section>

</body>

</html>